﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;

public partial class System_MasterPageTra : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //MsgBox.Aert_history("此功能暂时还没有开通", -1);
        //return;
        if (Session["Account"] != null)
        {
            ShowTitle();//显示项目号：
            this.labLogon.Text = "";
            lab1.Visible = false;

            HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
            HZ.MBSM.DAL.AccountType _AccountType = (HZ.MBSM.DAL.AccountType)SysFun.ToInt(_Account.Type);

            string strPageDescribePath = Server.MapPath("../System/PageDescribeTra.xml");
            HZ.MBSM.BLL.PageDescribeCollectionTra _PageDescribeCollection = new HZ.MBSM.BLL.PageDescribeCollectionTra();
            _PageDescribeCollection.LoadXML(strPageDescribePath);

            foreach (HZ.MBSM.BLL.PageDescribeTra _PageDescribe in _PageDescribeCollection.ChildrenPageDescribe)
            {
                for (int intIndex = _PageDescribe.ChildrenPageDescribe.Count - 1; intIndex >= 0; intIndex--)
                {
                    bool bolIsChecked = false;

                    foreach (HZ.MBSM.DAL.AccountType _AccountTypePage in _PageDescribe.ChildrenPageDescribe[intIndex].UseAccountType)
                    {
                        if (_AccountTypePage == _AccountType)
                        {
                            bolIsChecked = true;
                            break;
                        }
                    }

                    if (bolIsChecked == false)
                    {
                        _PageDescribe.ChildrenPageDescribe.RemoveAt(intIndex);
                    }
                }
            }

          
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (_Account.Type == "4")
            {
                sb.Append("<table width='232' border='0' cellspacing='0' cellpadding='0'>");
                sb.Append("<tr><td><img src='../Images/2_left_title1.jpg' width='232' height='14'></td></tr>");
                sb.Append("<tr><td align='center' background='../Images/left_bg.jpg'>");
                sb.Append("<table width='217' border='0' cellspacing='4' cellpadding='0'>");
                sb.Append("<tr><td>");
                sb.Append("<table width='100%' border='0' cellspacing='0' cellpadding='0'>");
                sb.Append("<tr>");
                sb.Append("<td></td>");//<img src='../Images/logo_JD.gif' with='232'/>
                sb.Append("</tr>");
                sb.Append("<tr>");
                sb.Append("<td class='2_left_bg'><img src='../Images/spacer.gif' width='40' height='10'><strong><span style=‘font-family: 宋体'>欢迎 <font color='#0066CC'>" + _Account.DWName + "</font>  登录系统</span></strong></td>");
                sb.Append("</tr>");
                sb.Append("<tr>");
                sb.Append("<td class='2_left_bg'><img src='../Images/spacer.gif' width='40' height='10'><strong><span style=‘font-family: 宋体'>用户名：<font color='#0066CC'>" + _Account.AccountName + "</font></span></strong> </td>");
                sb.Append("</tr>");
                //sb.Append("<tr>");
                //sb.Append("<td class='2_left_bg'><img src='../Images/spacer.gif' width='40' height='10'><strong><span style=‘font-family: 宋体'>注册号：<font color='#0066CC'>" + _Account.UserCode + "</font></span></strong> </td>");
                //sb.Append("</tr>");
                sb.Append("<tr><td class='2_left_bg2'><img src='../Images/spacer.gif' width='40' height='10'>");
                sb.Append("<a href='../HomePage/Logout.aspx'><strong><span style=‘font-family: 宋体'><font color='#0066CC'>◇注销</font></span></strong></a>");
                sb.Append("</td></tr>");
                sb.Append("</table>");
                sb.Append("</td></tr>");

                foreach (HZ.MBSM.BLL.PageDescribeTra _PageDescribe in _PageDescribeCollection.ChildrenPageDescribe)
                {
                    if (_PageDescribe.ChildrenPageDescribe.Count > 0)
                    {

                        sb.Append("<tr><td>");
                        sb.Append("<table width='100%' border='0' cellspacing='0' cellpadding='0'>");
                        sb.Append("<tr>");
                        sb.Append("<td class='2_left_bg'><img src='../Images/spacer.gif' width='40' height='10'><strong><span style=‘font-family: 宋体'>" + _PageDescribe.Name + "</span></strong></font></td>");
                        sb.Append("</tr>");
                        sb.Append("<tr><td><table width='100%' border='0' cellspacing='0' cellpadding='0'>");

                        foreach (HZ.MBSM.BLL.PageDescribeTra _PageDescribeChildren in _PageDescribe.ChildrenPageDescribe)
                        {
                            sb.Append("<tr><td class='2_left_bg2'><img src='../Images/spacer.gif' width='40' height='10'><strong><span style=‘font-family: 宋体'>");
                            if (SysFun.ToTrim(Request.QueryString["ProjectId"]) != "")
                            {
                                sb.Append("<a href='" + _PageDescribeChildren.Url + "?ProjectId=" + Request.QueryString["ProjectId"] + "'>◇" + _PageDescribeChildren.Name + "</a>");
                            }
                            else
                            {
                                sb.Append("<a href='" + _PageDescribeChildren.Url + "'>◇" + _PageDescribeChildren.Name + "</a>");
                            }
                            sb.Append("</span></strong></font></td></tr>");
                        }

                        sb.Append("</table></td></tr>");
                        sb.Append("</table>");
                        sb.Append("</td></tr>");
                    }
                }

                sb.Append("</table>");
                sb.Append("</td></tr><tr><td><img src='../Images/left_bottom.jpg' width='232' height='14'></td></tr>");
                sb.Append("</table>");
            }
            else
            {
                sb.Append("<table width='232' border='0' cellspacing='0' cellpadding='0'>");
                sb.Append("<tr><td><img src='../Images/2_left_title1.jpg' width='232' height='14'></td></tr>");
                sb.Append("<tr><td align='center' background='../Images/left_bg.jpg'>");
                sb.Append("<table width='217' border='0' cellspacing='4' cellpadding='0'>");
                sb.Append("<tr><td>");
                sb.Append("<table width='100%' border='0' cellspacing='0' cellpadding='0'>");
                sb.Append("<tr>");
                sb.Append("<td class='2_left_bg'><img src='../Images/spacer.gif' width='40' height='10'>欢迎 <font color='#0066CC'>" + _Account.DWName + " </font> 登录系统</td>");
                sb.Append("</tr>");
                //sb.Append("<tr>");
                //sb.Append("<td class='2_left_bg'><img src='../Images/spacer.gif' width='40' height='10'>用户名:<font color='#0066CC'>" + _Account.AccountName + "</font> </td>");
                //sb.Append("</tr>");
                sb.Append("<tr>");
                sb.Append("<td class='2_left_bg'><img src='../Images/spacer.gif' width='40' height='10'>注册号:<font color='#0066CC'>" + _Account.UserCode + "</font> </td>");
                sb.Append("</tr>");
                sb.Append("<tr><td class='2_left_bg2'><img src='../Images/spacer.gif' width='40' height='10'>");
                sb.Append("<a href='../HomePage/Logout.aspx'>◇注销</a>");
                sb.Append("</td></tr>");
                sb.Append("</table>");
                sb.Append("</td></tr>");

                foreach (HZ.MBSM.BLL.PageDescribeTra _PageDescribe in _PageDescribeCollection.ChildrenPageDescribe)
                {
                    if (_PageDescribe.ChildrenPageDescribe.Count > 0)
                    {
                        //汪东亮
                        //if ((_Account.Type == "2") && (_Account.Sort == "0") && ((_PageDescribe.Name == "结算管理") || (_PageDescribe.Name == "配送管理")))
                        //{
                        //    continue;
                        //}
                        if (_Account.Type == "3")
                        {
                            if (((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraPurchasePlanAddaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraPurchasePlanListaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraPurchasePlanAddaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraBackPlanAddaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraBackPlanListaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraConfirmGoodsaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "Paymentaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraBulidPaymentaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraCompanyPSaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraCompanySCaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraCompanyZBaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraFrontSortaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraGoodsaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraPaymentaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraStockListaspx"))
                            {
                                if ((_PageDescribe.Name == "交易数据管理") || (_PageDescribe.Name == "合同管理"))
                                {
                                    continue;
                                }
                            }
                            if (((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "ChooseHosPurchaseListTraaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "HospitalPurListaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "Tra_hospital_contractaspx") || (SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1]) == "ContractMangeaspx"))
                            {
                                if ((_PageDescribe.Name != "交易数据管理") && (_PageDescribe.Name != "合同管理") && (_PageDescribe.Name != "返回"))
                                {
                                    continue;
                                }
                            }
                        }
                        if (_Account.Type == "2")
                        {
                            if (((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "Tra_BidPlanListaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TrabidBacklistaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraConfirmPayMentaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraCompanySCaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraGoodsaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraHospitalaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraPaymentaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraStockListaspx"))
                            {
                                if ((_PageDescribe.Name == "维护配送企业") || (_PageDescribe.Name == "查看本企业中标药品") || (_PageDescribe.Name == "查看合同"))
                                {
                                    continue;
                                }
                            }
                            if (((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraSelectSuperviseNextAreaaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraSelectSuperviseNextaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraSelectSuperviseaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraLookbidProductaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "CompanyConstractaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraCompanyConstractLookaspx"|| ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraSuperise_Next_Listaspx")))
                            {
                                if ((_PageDescribe.Name == "配送管理") || (_PageDescribe.Name == "结算管理") || (_PageDescribe.Name == "交易查询"))
                                {
                                    continue;
                                }
                            }


                        }
                        if (_Account.Type == "1")
                        {
                            if (((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraAddbidaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraCheckIsbidcompany_PSFaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraCheckIsbidcompany_PSMaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraTradeDataListaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraTradeTotalAddaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "Tra_back_goodaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "Tra_NoComp_NoLimit_goodsaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "Update_waitPriceStateaspx"))
                            {
                                if ((_PageDescribe.Name == "合同管理") || (_PageDescribe.Name == "采购药品管理") || (_PageDescribe.Name == "交易查询") || (_PageDescribe.Name == "配送企业管理"))
                                {
                                    continue;
                                }
                            }

                            if (((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraCompany_ps_addaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraCompany_psReNameaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraConstractMangeSeleaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraContractMangeaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraPurchaseZeroaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraAreaaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraCompanyPSaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraHospitalQualityLevelsaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraCompanySCaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraCompanyZBaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraFrontSortaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraGoodsaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraHospitalaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraHospitalTypeaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraPaymentaspx") || ((SysFun.ToName2(this.Request.RawUrl.Split('?')[0].Split('/')[this.Request.RawUrl.Split('?')[0].Split('/').Length - 1])) == "TraStockListaspx"))
                            {
                                if (_PageDescribe.Name == "挂网目录管理")
                                {
                                    continue;
                                }
                            }
                        }
                        sb.Append("<tr><td>");
                        sb.Append("<table width='100%' border='0' cellspacing='0' cellpadding='0'>");
                        sb.Append("<tr>");
                        sb.Append("<td class='2_left_bg'><img src='../Images/spacer.gif' width='40' height='10'>" + _PageDescribe.Name + "</td>");
                        sb.Append("</tr>");

                         sb.Append("<tr><td><table width='100%' border='0' cellspacing='0' cellpadding='0'>");
                        foreach (HZ.MBSM.BLL.PageDescribeTra _PageDescribeChildren in _PageDescribe.ChildrenPageDescribe)
                        {
                            //汪东亮
                            //if ((_Account.Type == "2") && (_Account.Sort == "0") && ((_PageDescribeChildren.Name == "按结算单查询") || (_PageDescribeChildren.Name == "按采购单查询")))
                            //{
                            //    continue;
                            //}
                           
                            sb.Append("<tr><td class='2_left_bg2'><img src='../Images/spacer.gif' width='40' height='10'>");
                            if (SysFun.ToTrim(Request.QueryString["ProjectId"]) != "")
                            {
                                if (_Account.Type == "2" && _Account.Sort == "1" && _PageDescribeChildren.Name == "维护主配送企业")
                                {
                                    continue;
                                }

                                if (((_Account.Type == "2") || (_Account.Type == "4")) && (_PageDescribeChildren.Name == "按医院查询"))
                                {
                                    sb.Append("<a href='../Supervise/TraHospital.aspx?ProjectId=" + Request.QueryString["ProjectId"] + "'>◇" + _PageDescribeChildren.Name + "</a>");
                                }
                                else
                                {
                                    sb.Append("<a href='" + _PageDescribeChildren.Url + "?ProjectId=" + Request.QueryString["ProjectId"] + "'>◇" + _PageDescribeChildren.Name + "</a>");
                                }
                            }
                            else
                            {
                                sb.Append("<a href='" + _PageDescribeChildren.Url + "'>◇" + _PageDescribeChildren.Name + "</a>");
                            }
                            sb.Append("</td></tr>");
                            
                        }

                        sb.Append("</table></td></tr>");
                        sb.Append("</table>");
                        sb.Append("</td></tr>");
                    }
                }

                sb.Append("</table>");
                sb.Append("</td></tr><tr><td><img src='../Images/left_bottom.jpg' width='232' height='14'></td></tr>");
                sb.Append("</table>");
            }
            labPage.Text = sb.ToString();

            //多层树节点

            //Label labNodes = new Label();
            //ReadPageDescribeNode(_PageDescribeCollection.ChildrenPageDescribe, labNodes, 0);
            //labPage.Controls.Add(labNodes);
        }
        else
        {
            lab1.Text = WriteBoard();
            lab1.Visible = true;
        }
    }
    private void ShowTitle()//显示项目号
    {
        string projectid;       // 07/09/11   马
        if (Request.QueryString["projectid"] != null)
        {
            //projectid = Request.QueryString["projectid"].ToString();
            //Db DbProject = new Db();
            //string strStrSql = "select ProjectMarker,Title  from Project where ProjectId=" + projectid.ToString();
            //System.Data.IDataReader dr = DbProject.DataReader(strStrSql);
            ////if (dr.Read())
            ////{
                // labProjectMarker.Text = dr["ProjectMarker"].ToString();
                //labTitle.Text = dr["Title"].ToString();
                Showxn.Visible = false;
                // Showxn.Visible = false;
                //Showxn.Text = "<table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class='table_td'>    项目编码： </td> <td class='table_td2'>" + dr["ProjectMarker"].ToString() + "</td> <td class='table_td'> 项目名称： </td><td class='table_td2'>" + dr["Title"].ToString() + "</td> </tr></table>";

            //}
            //dr.Close();
            //dr.Dispose();
            //DbProject.Close();

        }
    }
    //将PageDescribe树写入到 ListView 中

    private void ReadPageDescribeNode(System.Collections.Generic.List<HZ.MBSM.BLL.PageDescribeTra> pageDescribes, Label treeNodeCollection, int space)
    {
        foreach (HZ.MBSM.BLL.PageDescribeTra _PageDescribe in pageDescribes)
        {
            Label labNode = new Label();
            string strSpace = "";
            for (int intIndex = 0; intIndex < space; intIndex++)
            {
                strSpace += "　";
            }
            if (_PageDescribe.Url != null && _PageDescribe.Url.Length > 0)
            {
                labNode.Text = strSpace + "<a href='" + _PageDescribe.Url + "'>" + _PageDescribe.Name + "</a><br>";
            }
            else
            {
                labNode.Text = strSpace + _PageDescribe.Name + "<br>";
            }
            treeNodeCollection.Controls.Add(labNode);

            Label labChildren = new Label();
            treeNodeCollection.Controls.Add(labChildren);

            if (_PageDescribe.ChildrenPageDescribe.Count > 0)
            {
                ReadPageDescribeNode(_PageDescribe.ChildrenPageDescribe, labChildren, space + 1);
            }
        }
    }
    public string Display_Title(object Title, int Len)
    {
        string Title_str = Title.ToString().Trim();
        if (Title_str != "")
        {
            //if(Title_str.Length > Len)
            //	Title_str = Title_str.Substring(0,Len)+"..";
            int ShowNum = WordCount(Title_str, Len);
            if (Title.ToString().Length > ShowNum)
                Title_str = Title.ToString().Substring(0, ShowNum - 1) + "....";
        }
        else
            Title_str = "";

        return Title_str;
    }
    public int WordCount(string Operand, int MaxNum)
    {
        IEnumerator OperandEnum = Operand.GetEnumerator();
        char ch = ' ';
        int i = 0;
        for (int CharCount = 0; OperandEnum.MoveNext() && CharCount <= MaxNum; i++)
        {
            ch = Convert.ToChar(OperandEnum.Current);
            if ((ch >= 32 && ch <= 126) || ch == '=')
                CharCount++;
            else
                CharCount += 2;
        }
        return i;
    }
    public string WriteBoard()
    {
        int i = 0;
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        HZ.MBSM.DBUtility.Db db = new HZ.MBSM.DBUtility.Db();

        string strSql = "select top 8 id,title from board  order by  id desc ";
        System.Data.IDataReader dr = db.DataReader(strSql);



        sb.Append("<table width='232' border='0' cellspacing='0' cellpadding='0'><tr><td><img src='../Images/left_title4.jpg' width='232' height='56'></td></tr><tr><td background='../Images/left_bg.jpg'><table width='90%' border='0' align='center' cellpadding='4' cellspacing='1'><tr><td >");


        sb.Append("<table  width='96%' border=0 align=center cellpadding=6 cellspacing=1>");
        while (dr.Read())
        {
            i++;
            sb.Append("<tr><td class='dotbottomline'>");
            sb.Append("<img src='../images/ico7.gif' width='8' height='5' hspace='4' vspace='1'>");
            sb.Append("<a href='../HomePage/Boardinfo.aspx?Id=" + dr["id"].ToString() + "' target=_blank>" + Display_Title(dr["Title"].ToString(), 20) + "</a>");
            sb.Append("</td></tr>");
        }
        for (int j = i; j < 8; j++)
            sb.Append("<tr><td class='dotbottomline'>&nbsp;</td></tr>");

        sb.Append("</table>");
        dr.Close();
        dr.Dispose();
        db.Close();
        sb.Append("</td></tr><tr align=right ><td><a href='../HomePage/BordList.aspx'>更多...</a></td></tr></table></td></tr><tr align=right><td><img src='../Images/left_bottom.jpg' width='232' height='14'></td></tr></table>");
        return sb.ToString();
    }
}
